<template>
  <div id="app">
    <div style="width: 100%; height: 200px;" ref="main2"></div>
  </div>
</template>
<script>
export default {
  props: {
    data: {
      type: Array,
    },
  },
  data() {
    return {
      popsList: [],
    };
  },
  mounted() {
    this.drawChart();
  },
  methods: {
    initInfo(item) {
      // console.log(item, "itemitemitemitemitem");
      this.drawChart();
    },
    drawChart() {
        // 基于准备好的dom，初始化echarts实例
        let that = this;
        // let myChart = this.$echarts.init(document.getElementById('main2'));
        let myChart = this.$echarts.init(this.$refs.main2);
        // 指定图表的配置项和数据
        let option = {
            tooltip: {
              show: true,
              trigger: "item",
            },
            radar: {
              // shape: 'circle',
              indicator: [
                { name: '用工指数', max: 170 },
                { name: '风险指数', max: 170 },
                { name: '经营指数', max: 170 },
                { name: '景气指数', max: 170 },
              ],
              name: {
                textStyle: {
                  padding: [-10, -12]  // 控制文字padding
                }
              }
            },
            color: that.data[1],
            series: [
                {
                  name: '产业用工指数',
                  type: 'radar',
                  data: that.data[0]
                }
            ]
        };

      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(option);
    }
  }
};
</script>
<style scoped lang="scss">
#main2 {
//   margin-top: 10px;
}
</style>
